// function createArray(length: number, value: any): any[] {
//   let result = []
//   for (let i = 0; i < length; i++) {
//     result[i] = value
//   }
//   return result
// }
function createArray<T>(length: number, value: T): T[] {
  let result: T[] = []
  for (let i = 0; i < length; i++) {
    result[i] = value
  }
  return result
}

createArray<string>(3, 'x')[0].trim() // ['x', 'x', 'x']
createArray<number>(2, 0)[0].toFixed() // [0,0]
